package com.mzj.saas.rent;


import com.haixiaoke.saas.repository.core.AjaxResult;
import com.haixiaoke.saas.repository.core.BaseController;
import com.haixiaoke.saas.repository.pojo.BusinessCircle;
import com.haixiaoke.saas.repository.service.IBusinessCircleService;
import com.haixiaoke.saas.repository.util.Tree.Node;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 商业区Controller
 *
 * @author haixiaoke
 * @date 2023-04-06
 */
@RestController
@RequestMapping("/base/businessCircle")
public class BusinessCircleController extends BaseController {
    @Autowired
    private IBusinessCircleService businessCircleService;

    /**
     * 查询商业区列表
     */
    @GetMapping("/list")
    public AjaxResult list(BusinessCircle businessCircle) {
        List<BusinessCircle> list = businessCircleService.selectBusinessCircleList(businessCircle);
        return success(list);
    }

    /**
     * 根据城市 id 查询商业区列表
     */
    @GetMapping("/comboList/{cityId}")
    public AjaxResult comboList(@PathVariable Long cityId) {
        List<Node> list = businessCircleService.selectComboListByCityId(cityId);
        return AjaxResult.success(list);
    }

}
